package edu.hubu.talentmanagementsystem.auth;

import org.springframework.security.core.GrantedAuthority;

import java.util.StringJoiner;

/**
 * @author moonlan
 * date 2021/2/9 下午3:19
 */
@SuppressWarnings(value = "unused")
public class JwtGrantedAuthority implements GrantedAuthority {

    private String authority;

    public JwtGrantedAuthority() {
        this("default");
    }

    public JwtGrantedAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public String getAuthority() {
        return this.authority;
    }

    public JwtGrantedAuthority setAuthority(String authority) {
        this.authority = authority;
        return this;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", JwtGrantedAuthority.class.getSimpleName() + "[", "]")
                .add("authority='" + authority + "'")
                .toString();
    }
}
